<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<%@ include file="/WEB-INF/pages/weixin/include/title.jsp"%>
    <%@ include file="/WEB-INF/pages/weixin/include/include.jsp"%>
    
	<script src="${root}/res/jsLib/jquery/jquery-1.11.1.min.js"></script>
	<script src="${root}/res/jsLib/Validform_v5.3.2_min.js"></script>
	<script src="${root}/res/jsLib/ValidformExp.js"></script>
    
    <script type="text/javascript">
    	
	    $(function(){
	    	wxUtils.showToast();
	    	wxUtils.loadDicData({
	    		urlFun:function(){
	    			return JSON.stringify({"method":"orgentinfo","id":'${user.userid}'});
	    		},
	    		showFun:function(data){
	    			wxUtils.closeToast();
	    			if(data.datalist.length>0){
	    				var u = data.datalist[0];
	    				console.info(u);
	    				var form = $("#userForm");
	    				form.find("input[name=orgId]").val(u['ID']);
	    				form.find("input[name=email]").val(u['EMAIL']);
	    				form.find("input[name=orgName]").val(u['ORG_NAME']);
	    				form.find("input[name=orgArea2]").val(u['ORG_AREA2']);
	    				form.find("input[name=legalPerson]").val(u['LEGAL_PERSON']);
	    				form.find("input[name=orgLinkman]").val(u['ORG_LINKMAN']);
	    				form.find("input[name=orgLinkmanPhone]").val(u['ORG_LINKMAN_PHONE']);
	    				form.find("input[name=orgTelephone]").val(u['ORG_TELEPHONE']);
	    				form.find("div[name=colleges]").html(u['COLLEGES']=='1'?'是':'否');
	    				form.find("div[name=association]").html(u['ASSOCIATION']=='1'?'是':'否');
	    				form.find("div[name=orgCode]").html(u['ORG_CODE']);
	    				form.find("div[name=registeredNo]").html(u['REGISTERED_NO']);
	    				form.find("div[name=userId]").html(u['USER_ID']);
	    				form.find("div[name=xydm]").html(u['XYDM']);
	    				form.find("input[name=orgFax]").val(u['ORG_FAX']);
	    				form.find("input[name=orgWeb]").val(u['ORG_WEB']);
	    				form.find("input[name=orgAddress]").val(u['ORG_ADDRESS']);
						$("#industry1").val(u['INDUSTRY1']);
						$("#industry2").val(u['INDUSTRY2']);
						$("#industry3").val(u['INDUSTRY3']);
						$("#industry4").val(u['INDUSTRY4']);
						
						form.find("img[name=qualification]").attr("src","http://aum.heyuanzhfw.org/aum/"+u['QUALIFICATION']);
						form.find("img[name=logo]").attr("src","http://aum.heyuanzhfw.org/aum/"+u['ORG_IMG']);
						
	    				wxUtils.loadDicData({
	    		    		urlFun:function(){
	    		    			return JSON.stringify({"method":"area1",'id':'441600'});
	    		    		},
	    		    		showFun:function(d1){
	    		    			for(var i=0; i<d1.datalist.length; i++){
	    		    				var trem = d1.datalist[i];
	    		    				if(trem['AREA_CODE']==u['ORG_AREA2']){
	    		    					$("#orgArea2").html("河源市-"+trem['AREA_NAME']);
	    		    					break;
	    		    				}
	    		    			}
	    		    		}
	    		    	});
	    				
	    				var od = u['ORG_TYPE'];
	    				if(od=='10'){
	    					$("div[name='orgType']").html("企业");
	    				}else if(od=='20'){
	    					$("div[name='orgType']").html("事业单位");
	    				}else if(od=='30'){
	    					$("div[name='orgType']").html("社会团体");
	    				}else if(od=='40'){
	    					$("div[name='orgType']").html("个体工商户");
	    				}else if(od=='99'){
	    					$("div[name='orgType']").html("其他");
	    				}
	    				
	    				var category = u['CATEGORY'];
	    				if(category=='100000'){
	    					$("div[name='category']").html("信息服务");
	    				}else if(category=='110000'){
	    					$("div[name='category']").html("投融资服务");
	    				}else if(category=='120000'){
	    					$("div[name='category']").html("创业服务");
	    				}else if(category=='130000'){
	    					$("div[name='category']").html("人才培训服务");
	    				}else if(category=='140000'){
	    					$("div[name='category']").html("技术创新服务");
	    				}else if(category=='150000'){
	    					$("div[name='category']").html("市场开拓服务");
	    				}else if(category=='160000'){
	    					$("div[name='category']").html("管理咨询服务");
	    				}else if(category=='170000'){
	    					$("div[name='category']").html("法律服务");
	    				}else if(category=='180000'){
	    					$("div[name='category']").html("商务服务");
	    				}
	    				
	    				
	    				loadRegType(u);
	    				loadholdingType(u);
	    				
	    				wxUtils.loadDicData({
	    		    		urlFun:function(){
	    		    			return JSON.stringify({"method":"area1",'id':'441600'});
	    		    		},
	    		    		showFun:function(d1){
	    		    			// 
	    		    			for(var i=0; i<d1.datalist.length; i++){
	    		    				var trem = d1.datalist[i];
	    		    				if(trem['AREA_CODE']==u['ORG_DESCRIPTION']){
	    		    					$("#orgArea2").html("河源市-"+trem['AREA_NAME']);
	    		    					break;
	    		    				}
	    		    			}
	    		    		}
	    		    	});
	    				
	    				industry1();
	    				
	    			}else{
	    				wxUtils.msg("加载用户基本信息失败，请稍后重试。",2,function(){
	    					window.location.href = wxUtils.ctx + "/weixin/login.do";
	    				});
	    			}
	    		}
	    	});
	    	
	    	$("#returnBtn").click(function(){
	    		window.location.href = wxUtils.ctx + "/weixin/login.do"; 
			});
	    	
	    	wxUtils.iniScrollBar();
	    });
	    
	    function industry1(){
	    	var form = $("#userForm");
	    	var def = $("#industry1");
	    	var industry = form.find("select[name='industry1']");
	    	if(industry.length>0){
	    		industry.empty();
	    		form.find("select[name='industry2']").empty();
	    		form.find("select[name='industry3']").empty();
	    		form.find("select[name='industry4']").empty();
		    	wxUtils.loadDicData({
		    		urlFun:function(){
		    			return JSON.stringify({"method":"industry"});
		    		},
		    		showFun:function(data){
		    			var flag = false;
		    			industry.append("<option value=''>--请选择--</option>");
		    			for(var i=0; i<data.datalist.length; i++){
		    				var trem = data.datalist[i];
		    				var selected = '';
		    				if(def.val()==trem['INDUSTRY_CODE']){
		    					selected='selected="selected"';
		    					flag=true;
		    				}
		    				industry.append("<option "+selected+" value='"+trem['INDUSTRY_CODE']+"'>"+trem['INDUSTRY_NAME']+"</option>");
		    			}
		    			if(flag){
		    				industry.trigger("change");
		    				def.val('');
		    			}
		    		}
		    	});
	    	}
	    }
	    
	    function industry234(i,parent){
	    	var form = $("#userForm");
	    	var id = $(parent).val();
	    	var industry = form.find("select[name='industry"+i+"']");
	    	var def = $("#industry"+i);
	    	if(industry.length>0 && $.trim(id)!=''){
	    		industry.empty();
	    		if(i<3){
	    			var temp = form.find("select[name='industry3']")
	    			temp.empty();
	    			temp.append("<option value=''>--请选择--</option>");
	    		}
	    		if(i<4){
	    			var temp = form.find("select[name='industry4']")
	    			temp.empty();
	    			temp.append("<option value=''>--请选择--</option>");
	    		}
	    		wxUtils.loadDicData({
		    		urlFun:function(){
		    			return JSON.stringify({"method":"industry234","id":id});
		    		},
		    		showFun:function(data){
		    			var flag = false;
		    			industry.append("<option value=''>--请选择--</option>");
		    			for(var i=0; i<data.datalist.length; i++){
		    				var trem = data.datalist[i];
		    				var selected = '';
		    				if(def.val()==trem['INDUSTRY_CODE']){
		    					selected='selected="selected"';
		    					flag=true;
		    				}
		    				industry.append("<option "+selected+" value='"+trem['INDUSTRY_CODE']+"'>"+trem['INDUSTRY_NAME']+"</option>");
		    			}
		    			if(flag){
		    				industry.trigger("change");
		    				def.val('');
		    			}
		    		}
		    	});
	    	}else{
	    		industry.empty();
	    	}
	    }
	    
	    /**
	    *加载企业注册类型
	    */
	    function loadRegType(u){
	    	var regType1 = u['REG_TYPE1'];
			var regType2 = u['REG_TYPE2'];
			var regType3 = u['REG_TYPE3'];
			
			wxUtils.loadDicData({
	    		urlFun:function(){
	    			return JSON.stringify({"method":"dicregtype"});
	    		},
	    		showFun:function(d1){
	    			if(d1.datalist){
		    			for(var i=0; i<d1.datalist.length; i++){
		    				var trem = d1.datalist[i];
		    				if(trem['REG_CODE']==regType1){
		    					$("span[name='regType1']").html(trem['REG_NAME'])
		    				}
		    			}
	    			}
	    		}
	    	});
			
			wxUtils.loadDicData({
	    		urlFun:function(){
	    			return JSON.stringify({"method":"dicregtype23","id":regType1});
	    		},
	    		showFun:function(d1){
	    			if(d1.datalist){
		    			for(var i=0; i<d1.datalist.length; i++){
		    				var trem = d1.datalist[i];
		    				if(trem['REG_CODE']==regType2){
		    					$("span[name='regType2']").html("--"+trem['REG_NAME'])
		    				}
		    			}
	    			}
	    		}
	    	});
			
			wxUtils.loadDicData({
	    		urlFun:function(){
	    			return JSON.stringify({"method":"dicregtype23","id":regType2});
	    		},
	    		showFun:function(d1){
	    			if(d1.datalist){
		    			for(var i=0; i<d1.datalist.length; i++){
		    				var trem = d1.datalist[i];
		    				if(trem['REG_CODE']==regType3){
		    					$("span[name='regType3']").html("--"+trem['REG_NAME'])
		    				}
		    			}
	    			}
	    		}
	    	});
	    }
	    
	    /**
	    *加载控股类型
	    */
	    function loadholdingType(u){
	    	var holdingType1 = u['HOLDING_TYPE1'];
			var holdingType2 = u['HOLDING_TYPE2'];
			var holdingType3 = u['HOLDING_TYPE3'];
			
			wxUtils.loadDicData({
	    		urlFun:function(){
	    			return JSON.stringify({"method":"dicholdingtype"});
	    		},
	    		showFun:function(d1){
	    			if(d1.datalist){
		    			for(var i=0; i<d1.datalist.length; i++){
		    				var trem = d1.datalist[i];
		    				if(trem['HOLDING_CODE']==holdingType1){
		    					$("span[name='holdingType1']").html(trem['HOLDING_NAME'])
		    				}
		    			}
	    			}
	    		}
	    	});
			
			wxUtils.loadDicData({
	    		urlFun:function(){
	    			return JSON.stringify({"method":"dicholdingtype23","id":holdingType1});
	    		},
	    		showFun:function(d1){
	    			if(d1.datalist){
		    			for(var i=0; i<d1.datalist.length; i++){
		    				var trem = d1.datalist[i];
		    				if(trem['HOLDING_CODE']==holdingType2){
		    					$("span[name='holdingType2']").html("--"+trem['HOLDING_NAME'])
		    				}
		    			}
	    			}
	    		}
	    	});
			
			wxUtils.loadDicData({
	    		urlFun:function(){
	    			return JSON.stringify({"method":"dicholdingtype23","id":holdingType2});
	    		},
	    		showFun:function(d1){
	    			if(d1.datalist){
		    			for(var i=0; i<d1.datalist.length; i++){
		    				var trem = d1.datalist[i];
		    				if(trem['HOLDING_CODE']==holdingType3){
		    					$("span[name='holdingType3']").html("--"+trem['HOLDING_NAME'])
		    				}
		    			}
	    			}
	    		}
	    	});
	    }
	</script>
</head>
<body>
<div class="page" style="height: 100%;">
    <div class="page__bd">
    	<div class="weui-tab__panel detail_panel">
    		<div class="weui-panel__hd" id="returnBtn" style="cursor: pointer;left:0;padding-left: 0;" position="top">&lt 返回</div>
			<div position="center">
				<input type="hidden" id="industry1"/>
				<input type="hidden" id="industry2""/>
				<input type="hidden" id="industry3"/>
				<input type="hidden" id="industry4"/>
				<form id="userForm">
				<input type="hidden" name="username" value="${user.username }"/>
				<input type="hidden" name="orgArea1" value="441600"/>
				<input type="hidden" name="orgArea2"/>
				<input type="hidden" name="orgId"/>
				<div class="weui-cells weui-cells_form">
					<div class="weui-cells__title">账号信息</div>
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">用户名</label></div>
		                <div class="weui-cell__bd">
		                    ${user.username }
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">企业名称</label></div>
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="orgName" disabled="disabled"/>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">法人代表</label></div>
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="legalPerson" disabled="disabled"/>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">联系人</label></div>
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="orgLinkman" disabled="disabled"/>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">联系电话</label></div>
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="orgLinkmanPhone" disabled="disabled"/>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">手机</label></div>
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="orgTelephone" disabled="disabled"/>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">E-mail</label></div>
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="email" disabled="disabled"/>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">传真</label></div>
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="orgFax" disabled="disabled"/>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">公司主页</label></div>
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="orgWeb" disabled="disabled"/>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">公司地址</label></div>
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="orgAddress" disabled="disabled"/>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">单位性质</label></div>
		                <div class="weui-cell__bd">
		                	<div name="orgType"></div>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">是否院校</label></div>
		                <div class="weui-cell__bd">
		                	<div name="colleges"></div>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">是否协会</label></div>
		                <div class="weui-cell__bd">
		                	<div name="association"></div>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">组织中介代码</label></div>
		                <div class="weui-cell__bd">
		                	<div name="orgCode"></div>
		                </div>
		            </div>
		            
		             <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">工商注册号</label></div>
		                <div class="weui-cell__bd">
		                	<div name="registeredNo"></div>
		                </div>
		            </div>
		            
		             <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">身份证号</label></div>
		                <div class="weui-cell__bd">
		                	<div name="userId"></div>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">社会信用代码</label></div>
		                <div class="weui-cell__bd">
		                	<div name="xydm"></div>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">服务类别</label></div>
		                <div class="weui-cell__bd">
		                	<div name="category"></div>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">企业注册类型</label></div>
		                <div class="weui-cell__bd">
		                	<span name="regType1"></span><span name="regType2"></span><span name="regType3"></span>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">控股类型</label></div>
		                <div class="weui-cell__bd">
		                	<span name="holdingType1"></span><span name="holdingType2"></span><span name="holdingType3"></span>
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">所属地区</label></div>
		                <div class="weui-cell__bd" id="orgArea2">
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">所属行业</label></div>
		                <div class="weui-cell__bd">
		                    <select class="weui-select" disabled="disabled" name="industry1" dataType="*" onchange="industry234(2,this)"><option value="">--请选择--</option></select>
		                    <select class="weui-select" disabled="disabled" name="industry2" dataType="*" onchange="industry234(3,this)"><option value="">--请选择--</option></select>
		                    <select class="weui-select" disabled="disabled" name="industry3" dataType="*" onchange="industry234(4,this)"><option value="">--请选择--</option></select>
		                    <select class="weui-select" disabled="disabled" name="industry4" dataType="*"><option value="">--请选择--</option></select>
		                </div>
		            </div>
		            
		             <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">复印件</label></div>
		                <div class="weui-cell__bd">
		                	<img name="qualification" src="" width="100px" height="100px">
		                </div>
		            </div>
		            
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">logo</label></div>
		                <div class="weui-cell__bd">
		                	<img name="logo" src="" width="100px" height="100px">
		                </div>
		            </div>
		            
		        </div>
		        </form>
			</div>
    	</div>
    </div>
</div>
</body>
</html>

